/******************************************************************************
 * Copyright (C) 2025 Engineer Liu Si 
 * 
 * All Rights Reserved.
 * 
 * @file bsp_led.c
 * 
 * @par dependencies 
 * - stdio.h
 * - stdint.h
 * 
 * @author liusi
 * 
 * @brief Provide the HAL APIs of Led and corresponding opetions.
 * 
 * Processing flow:
 * 
 * call directly.
 * 
 * @version V1.0 2025-09-27
 *
 * @note 1 tab == 4 spaces!
 * 
 *****************************************************************************/
 
#ifndef _BSP_LED_H_
#define _BSP_LED_H_

//******************************** Includes *********************************//

#include <stdint.h>              // the compiling         
#include <stdio.h>

#include "main.h"                // Core / OS layer 
#include "cmsis_os.h"
#include "queue.h"

//******************************** Includes *********************************//

//******************************** Defines **********************************//
#define OS_SUPPORTING 

//******************** Thread_Func ***********************//
extern osThreadId_t led_TaskHandle;
extern const osThreadAttr_t led_Task_attributes;
//******************** Thread_Func ***********************//


//******************* Queue_Handler **********************//
extern QueueHandle_t led_queue;

//******************* Queue_Handler **********************//

typedef enum
{
  LED_OK                = 0,           /* Operation completed successfully.  */
  LED_ERROR             = 1,           /* Run-time error without case matched*/
  LED_ERRORTIMEOUT      = 2,           /* Operation failed with timeout      */
  LED_ERRORRESOURCE     = 3,           /* Resource not available.            */
  LED_ERRORPARAMETER    = 4,           /* Parameter error.                   */
  LED_ERRORNOMEMORY     = 5,           /* Out of memory.                     */
  LED_ERRORISR          = 6,           /* Not allowed in ISR context         */
  LED_RESERVED          = 0x7FFFFFFF   /* Reserved                           */
} led_status_t;

typedef enum
{
  LED_ON                = 0,           /* Operation completed successfully.  */
  LED_OFF               = 1,           /* Operation completed successfully.  */
  LED_TOGGLE            = 2,           /* Operation completed successfully.  */
  LED_TWO_TOGGLE        = 3,           /* Operation completed successfully.  */
  LED_THREE_TOGGLE      = 4,           /* Operation completed successfully.  */
  LED_FOUR_TOGGLE       = 5,           /* Operation completed successfully.  */
	LED_TEN_TOGGLE        = 6,           /* Operation completed successfully.  */
} led_operation_t;

//******************************** Defines **********************************//

//******************************** Declaring ********************************//
/**
 * @brief Instantiates the bsp_led_handler_t target.
 * 
 * Steps:
 *  1.doing the specific operations.
 *  
 * 
 * @param[in] void
 * @return led_handler_status_t : Status of the function.
 * 
 * */
led_status_t led_on_off( led_operation_t led_operation );

/**
 * @brief Led_Task_Func for thread to run.
 * 
 * Steps:
 *  1.doing the specific operations.
 *  
 * 
 * @param[in] void
 * @return led_handler_status_t : Status of the function.
 * 
 * */
void         Led_Task_Func             (void *argument);

/**
 * @brief Led_Task_Func for thread to run.
 * 
 * Steps:
 *  1.doing the specific operations.
 *  
 * 
 * @param[in] void
 * @return led_handler_status_t : Status of the function.
 * 
 * */
led_status_t LED_OP_Function                    (void);
//******************************** Declaring ********************************//
 

 
#endif //End of _BSP_LED_H_
